#ifndef PATIENTRECORD_H
#define PATIENTRECORD_H

#include "ASTM.h"
#include "OrderRecord.h"

#include <QObject>

class PatientRecord : public ASTM
{
public:
    enum SexType {
        SexUnknow,
        Male,
        Female
    };

    enum VisitType {
        Clinic,
        Emergency,
        Hospitalization,
        PhysicalExamination,
        VisitUnknow
    };

    PatientRecord();

    QString buildRecord() const;
    bool analyzeRecord(const QString &str);

    void addOrder(const OrderRecord &order);
    int orderIndexOf(const QString sampleId) const;

    int frameIndex = 1;
    /// 病人ID（门诊号）
    QString id;
    /// 病人姓名
    QString name;
    /// 病人年龄
    QString age;
    /// 病人性别
    SexType sexType = SexUnknow;
    /// 就诊类型
    VisitType visitType = Clinic;
    /// 病床号/住院号
    QString bed;
    /// 主治医生姓名
    QString doctor;
    /// 诊断科室
    QString department;

    QList<OrderRecord> orders;

private:
    QStringList sexTypeList{"U", "M", "F"};
    QStringList visitTypeList{"C", "E", "H", "P", "U"};
};
Q_DECLARE_METATYPE(PatientRecord);

#endif // PATIENTRECORD_H
